package fileupdownYouhua.service;

import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

public class UploadMeth {
    public static void UploadMethService(String submittedFileName, InputStream fileContent){

        OutputStream outputStream = null;
        try {
            outputStream = new
                    FileOutputStream("D:\\CodeAll\\code\\FirstWeb\\src\\main\\webapp\\resourse\\"+submittedFileName);
            byte[] bytes = new byte[1024];
            int len = 0;
            //存储文件
            while (-1!= (len =fileContent.read(bytes) )){
                outputStream.write(bytes,0,len);
            }
            fileContent.close();
            outputStream.flush();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

    }
}
